package structure.composite;

/**
 * @author lzp
 * @Date:2023/2/24
 * @description: 组合测试案例
 */
public class CompositeDemo {

	public static void main(String[] args) {
		String xmlStr = new ElementNode("html")
				.add(new ElementNode("head")
						.add(new ElementNode("title").add(new TextNode("首页"))))
				.add(new ElementNode("body")
						.add(new ElementNode("button").add(new TextNode("点我呀"))))
				.add(new CommentNode("下面改写js脚本了"))
				.add(new ElementNode("script")).toXML();

		System.out.println(xmlStr);
	}

}
